using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Xml;
using System.Windows.Media;

namespace KeyboardImageViewer
{
	public class ImageItem
	{
		private string name;
		private DateTime lastWriteTime;
		private DateTime lastRefreshDate;
		private string hash;
		private int rating;
		private StringBag tags;
        private StringBag dependentTags;
        private ImageSummary imageSummary;

		public ImageItem()
		{
		}

		public ImageItem(string name)
		{
			this.name = name;
		}

		public string Name
		{
			get { return this.name; }
			set { this.name = value; }
		}

		public DateTime LastWriteTime
		{
			get { return this.lastWriteTime; }
			set { this.lastWriteTime = value; }
		}

		public DateTime LastRefreshDate
		{
			get { return this.lastRefreshDate; }
			set { this.lastRefreshDate = value; }
		}

		public string Hash
		{
			get { return this.hash; }
			set { this.hash = value; }
		}

		public int Rating
		{
			get { return this.rating; }
			set { this.rating = value; }
		}

		public StringBag Tags
		{
			get
            {
                return this.tags;
            }
			set
            {
                this.tags = value;
            }
		}

        public StringBag DependentTags
        {
            get { return this.dependentTags; }
        }

        public ImageSummary ImageSummary
        {
            get { return this.imageSummary; }
            set { this.imageSummary = value; }
        }

        public void RebuildDependentTags(List<KeyValuePair<string, string>> dependencyList)
        {
            if (this.tags == null)
            {
                this.dependentTags = null;
                return;
            }

            this.dependentTags = new StringBag();

            foreach (KeyValuePair<string, string> dependency in dependencyList)
            {
                if (this.tags.Contains(dependency.Key))
                {
                    this.dependentTags.Add(dependency.Value);
                }
            }
        }
	}
}
